/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;
import javafx.scene.Group;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.scene.input.MouseEvent;

/**
 * @author Sik
 */

public class InteractButton extends Group
{
    public var isPossible : Boolean = true;
    public-read var height : Number = 20;
    var border : Circle =
    Circle
    {
        pickOnBounds: true
	centerX: height/2, centerY: height/2
	radius: height/2
	fill: null
        stroke: Color.WHITE
        strokeWidth: 2
    }

    public-init var image : String;

    var fx : ImageView =
    ImageView
    {
        fitHeight: height
        preserveRatio: true
        image: Image
        {
            url: image
        }
    }

    init
    {
        ini();
        onMousePressed = function(e:MouseEvent) : Void
        {
            if(isPossible)
            {
                border.stroke = Color.BLUE;
            }
            else
            {
                border.stroke = Color.RED;
            }
        }
        onMouseReleased = function(e:MouseEvent) : Void
        {
            border.stroke = Color.WHITE
        }
        content =
            [
                border, fx
            ];
        
        
    }

    public function ini(): Void
    {

    }

    public function close(): Void
    {
    }
}
